package com.yuda.campsite.conf;

import com.alibaba.alicloud.context.AliCloudProperties;
import com.alibaba.alicloud.context.oss.OssProperties;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OssConf {

    @Bean(name = "ossClientInter")
    public OSS ossClientInter(AliCloudProperties aliCloudProperties,
                              OssProperties ossProperties) {
        return new OSSClientBuilder().build("oss-cn-beijing-internal.aliyuncs.com",
                aliCloudProperties.getAccessKey(), aliCloudProperties.getSecretKey(),
                ossProperties.getConfig());
    }

//
//    @Bean(name = "ossClientOuter")
//    public OSS ossClientOuter(AliCloudProperties aliCloudProperties,
//                              OssProperties ossProperties) {
//        return new OSSClientBuilder().build("oss-cn-beijing.aliyuncs.com",
//                aliCloudProperties.getAccessKey(), aliCloudProperties.getSecretKey(),
//                ossProperties.getConfig());
//    }
}
